<!DOCTYPE html>
<html lang="en" xmlns:sec="http://www.thymeleaf.org/extras/spring-security" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('发射机节目列表·')"/>
    <link rel="stylesheet" th:href="@{/admin/css/other/user.css}"/>
</head>
<body class="pear-container">
<div class="layui-row layui-col-space15">
    <div class="layui-col-md3">
        <div class="layui-card">
            <div class="layui-card-body">
                <div id="organizationTreeContent" style="overflow: auto">
                    <ul id="dataTree" class="dtree organizationTree" data-id="0" ></ul>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-col-md9">
        <div class="layui-card">
            <div class="layui-card-body">
                <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                    <legend>发射机节目列表</legend>
                  </fieldset>
                  <table id="myTable" lay-filter="myTable"></table>
            </div>
        </div>
    </div>
</div>
</div>
</body>



<th:block th:include="include :: footer"/>
<script>
    layui.use(['table', 'form', 'jquery', 'popup', 'common','dtree'], function () {
        let table = layui.table;
        let $ = layui.jquery;
        let dtree = layui.dtree;
        let MODULE_PATH = "/system/transmittertask/";
        //树
        var DemoTree = dtree.render({
            elem: "#dataTree",//html中的id值
            type: "all",
            url:MODULE_PATH +"getStaionTransmitter",//url
            method:"get",
            initLevel: "2",
            icon:'2',
            firstIconArraylayui:"0",
            checkbar: true,
            checkbarType: "only",//显示半选中状态
            success:function (data) {
            },
            checkbarFun:{
                chooseDone: function(checkbarNodesParam) {//点击复选框的事件
                    var datas=dtree.getCheckbarNodesParam("dataTree");
                    var data=[];
                    for (let i = 0; i < datas.length; i++) {
                        var parentNode = dtree.getParam(DemoTree, datas[i].parentId)
                        if(parentNode.checked==1){
                        }else{
                            data.push(datas[i].nodeId);
                        }
                    }
                    getTransmiters(data)
                }
            }
        });
       function getTransmiters(transCode){
           let cols = [
               [
                   {
                       title: '任务ID',
                       field: 'taskCode',
                       align: 'center'
                   },
                   {
                       title: '台站ID',
                       field: 'stationCode',
                       align: 'center'
                   },
                   {
                       title: '发射机ID',
                       field: 'transCode',
                       align: 'center'
                   },
                   {
                       title: '通道号',
                       field: 'taskId',
                       align: 'center',
                       sort: true
                   },
                   {
                       title: '开始时间',
                       field: 'sendDateTime',
                       align: 'center',
                       templet: '#table-status',
                       sort: true
                   },
                   {
                       title: '工作频率',
                       field: 'operType',
                       align: 'center',
                       templet: '#table-Register',
                       sort: true
                   },
                   {
                       title: '通道状态',
                       field: 'channelRfChState',
                       align: 'center'
                   },
                   {
                       title: '跳频时隙',
                       field: 'channelTimeSlot',
                       align: 'center'
                   },
                   {
                       title: '输出功率',
                       field: 'channelEqualization',
                       align: 'center'
                   },
                   {
                       title: '调制模式',
                       field: 'channelRfChMod',
                       align: 'center'
                   },
                   {
                       title: '调制宽度',
                       field: 'channelRfChBand',
                       align: 'center'
                   },
                   {
                       title: '音源',
                       field: 'channelRfChASource',
                       align: 'center'
                   },
                   {
                       title: '音源地址',
                       field: 'channelRfChAUrl',
                       align: 'center'
                   },
                   {
                       title: '发送时间',
                       field: 'sendTime',
                       align: 'center'
                   }
                   ,{
                       title: '操作',
                       toolbar: '#bar',
                       align: 'left',
                       width: 160,
                       fixed: 'right'
                   }
               ]
           ]

           table.render({
               elem: '#myTable',
               url: MODULE_PATH +'getTransmitterTaskByID',
               page: true,
               cols: cols,
               skin: 'line',
               toolbar: '#titlelbar',
               defaultToolbar: [],
               done: function (res, curr, count) {
               },
               response: {
                   statusName: 'code',//规定数据状态的字段名称，默认：code
                   statusCode: 200, //规定成功的状态码，默认：0
                   msgName: 'msg', //规定状态信息的字段名称，默认：msg
                   countName: 'count', //规定数据总数的字段名称，默认：count
                   dataName: 'data' //规定数据列表的字段名称，默认：data
               },
               autoSort: true,
               initSort: {
                   field: 'status',
                   type: 'asc'
               }
           });
        }
        function previewImg(obj) {

        }
    })
</script>
</html>